package com.pinyoumei.app.adapter;

import android.graphics.Paint;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.pinyoumei.app.R;
import com.pinyoumei.app.bean.HpSearchBean;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

/**
 * Created by Administrator on 2021-08-09.
 * --------- 日期 ------- 维护人 ------------ 变更内容 --------
 * 2021-08-09        Administrator             新增Person类
 * 2021-08-09        Administrator             增加sex属性
 */
public class HpSearchListAdapter extends BaseQuickAdapter<HpSearchBean.ResultBean.GoodsListBean, BaseViewHolder> {
    public HpSearchListAdapter(int layoutResId, @Nullable List<HpSearchBean.ResultBean.GoodsListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, HpSearchBean.ResultBean.GoodsListBean item) {
        ImageView iv_pt_goods_img = helper.getView(R.id.iv_bg);

        Glide.with(mContext).load(item.getGoods_img()).into(iv_pt_goods_img);

        helper.setText(R.id.tv_goods_name,item.getGoods_name());
        helper.setText(R.id.tv_sale_price,item.getSale_price()+"");

        TextView tv_market_price = helper.getView(R.id.tv_market_price);
        tv_market_price.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG);  // 设置中划线并加清晰
        tv_market_price.setText(item.getMarket_price()+"");


        helper.setText(R.id.tv_sale_num,"已售" + item.getSale_num()+"");
    }
}
